from __future__ import print_function
from pylab import *
import sys
from camori import EdgelSet
import simplejson


if __name__ == '__main__':
    finput = open(sys.argv[1])
    job_params = simplejson.load(finput)
    finput.close()

    fileroot = job_params['root_directory']

    if len(sys.argv) > 2:
        the_frms = [int(sys.argv[2])]
    else:
        the_frms = range(job_params['first_frame'], 1+job_params['last_frame']) 

    for frm in the_frms:
        filename = fileroot+'/edgels/edgels-%04d.npz'%(frm)

        Ia = EdgelSet(filename, 1.0,1.0)

        print(frm, Ia.orientation)
